import React, { Component } from 'react';
import { connect } from 'react-redux'
import { Modal, Form, Input, Select, Table, InputNumber, DatePicker, Popconfirm, Radio, Row, Col, } from 'antd';
import moment from 'moment'
const RadioGroup = Radio.Group;
const FormItem = Form.Item;
const Option = Select.Option;

class AddDetailModal extends Component {
    constructor(props) {
        super(props);
        this.state = {
            visible: false,
        };
    }

    showModelHandler = (e) => {
        if (e) e.stopPropagation();
        this.props.form.resetFields();
        this.setState({
            visible: true,
        });
    };

    okHandler = () => {
        const { addRepairDetailHandle } = this.props;
        this.props.form.validateFields((err, values) => {
            if (!err) {
                addRepairDetailHandle(values);
                this.props.form.resetFields();
            }
        });
    };
    render() {
        const { children, dispatch, title, item, rackList } = this.props;
        const { getFieldDecorator } = this.props.form;
        const formItemLayout = {
            labelCol: { span: 6 },
            wrapperCol: { span: 14 },
        };


        return (
            <span>
                <Modal
                    maskClosable={this.props.maskClosable}
                    confirmLoading={this.props.confirmLoading}
                    title={'故障原因'+'\t'+'(资产编号:'+item.assetNo+'\t'+'资产名称：'+item.assetName+')'}
                    visible={this.props.visible}
                    // width={1000}
                    onOk={this.okHandler}
                    onCancel={this.props.onCancel}
                    key={this.props.newKey}
                >
             
                     <FormItem style={{ marginBottom: '0px' }}>
                        {getFieldDecorator('assetId', { initialValue: item.id_ + '' })(
                            <Input type="hidden" />
                        )}
                    </FormItem>
                    <FormItem>
                        {
                            getFieldDecorator('remark', {
                                rules: [{ max: 200, message: '备注信息 200 字符以内' },]
                            })(<Input type="textarea" autosize={{ minRows: 4, maxRows: 4 }} />)
                        }
                    </FormItem>
                </Modal>

            </span>
        );
    }

}

export default Form.create()(AddDetailModal)
